<%--
  Created by IntelliJ IDEA.
  User: hellcat
  Date: 2020/1/14
  Time: 17:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@include file="extra/body.jsp" %>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">${promotionType}</div>
                <div class="layui-card-body">
                    <div class=layui-form">
                        <form class="layui-form" id="promotionCreateForm" lay-filter="promotionCreateForm" autocomplete="off">
                            <div class="layui-form-item" style="padding: 8px; background-color: #F2F2F2;">
                                <div class="layui-row layui-col-space10 layout">
                                    <div class="layui-col-md10">
                                        <div class="layui-col-md12">
                                            <div class="layui-card">
                                                <div class="layui-card-header" style="font-weight:900">活动信息</div>
                                                <div class="layui-card-body">
                                                    <%--        第一排--%>
                                                    <div class="layui-inline">
                                                        <label class="layui-form-label">活动名称</label>
                                                        <div class="layui-input-inline">
                                                            <input class="layui-input" type="text" name="promotionName"
                                                                   lay-verify="required">
                                                        </div>
                                                        <label class="layui-form-label">活动说明</label>
                                                        <div class="layui-input-inline">
                                                            <input class="layui-input" type="text" name="promotionDescribe">
                                                        </div>
                                                    </div>
                                                    <%--        第二排--%>
                                                    <div class="layui-inline">
                                                        <label class="layui-form-label">活动日期</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" class="layui-input" id="promotionDate" name="promotionDate"
                                                                   lay-verify="required" readonly="readonly">
                                                        </div>
                                                        <label class="layui-form-label">活动时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" class="layui-input" id="promotionTime" name="promotionTime"
                                                                   lay-verify="required" readonly="readonly">
                                                        </div>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-col-md12">
                                            <div class="layui-card">
                                                <div class="layui-card-header" style="font-weight:900">促销规则</div>
                                                <div class="layui-card-body" id="ruleBody">
                                                    <c:if test="${promotionType=='限时满减'}">
                                                        <div class="layui-inline">
                                                            <label class="layui-form-label">满</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input unit moneyFormatter" name="promotionMoney1"
                                                                       lay-verify="required" type="text">
                                                                <span class="span">元</span>
                                                            </div>
                                                            <label class="layui-form-label">减</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input unit moneyFormatter money2Check"
                                                                       name="promotionMoney2"
                                                                       lay-verify="required" type="text">
                                                                <span class="span">元</span>
                                                            </div>
                                                            <button type="button" class="layui-btn layui-btn-normal promotionRuleAddBtn">
                                                                <i class="layui-icon">&#xe654;</i>添加
                                                            </button>
                                                        </div>
                                                    </c:if>
                                                    <c:if test="${promotionType=='限时折扣'}">
                                                        <div class="layui-inline">
                                                            <label class="layui-form-label">满</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input unit moneyFormatter" name="promotionMoney1"
                                                                       lay-verify="required" type="text">
                                                                <span class="span">元</span>
                                                            </div>
                                                            <label class="layui-form-label">打</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input unit money2Check discountFormatter"
                                                                       name="promotionMoney2"
                                                                       lay-verify="required" type="text">
                                                                <span class="span">折</span>
                                                            </div>
                                                            <button type="button" class="layui-btn layui-btn-normal promotionRuleAddBtn">
                                                                <i class="layui-icon">&#xe654;</i>添加
                                                            </button>
                                                        </div>
                                                    </c:if>
                                                    <c:if test="${promotionType=='特价商品'}">
                                                        <div class="layui-inline">
                                                            <label class="layui-form-label">特价商品</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input" type="text" name="promotionMoney1"
                                                                       placeholder="商品条码/名称" style="padding-right: 60px;">
                                                                <button type="button"
                                                                        class="layui-btn layui-btn-primary promotionInSearchByIdOrName"
                                                                        style="position: absolute;top: 0;right: 0px;">
                                                                    <i class="layui-icon">&#xe615;</i>
                                                                </button>
                                                            </div>
                                                            <label class="layui-form-label">特价金额</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input unit moneyFormatter money2Check"
                                                                       name="promotionMoney2"
                                                                       lay-verify="required" type="text">
                                                                <span class="span">元</span>
                                                            </div>
                                                            <button type="button" class="layui-btn layui-btn-normal promotionRuleAddBtn">
                                                                <i class="layui-icon">&#xe654;</i>添加
                                                            </button>
                                                        </div>
                                                    </c:if>
                                                    <c:if test="${promotionType=='特价分类'}">
                                                        <div class="layui-inline">
                                                            <label class="layui-form-label">分类名称</label>
                                                            <div class="layui-input-inline">
                                                                <select lay-filter="Category" name="promotionMoney1">
                                                                    <c:forEach items="${Category1}" var="Category">
                                                                        <option value="${Category.categoryId}">${Category.categoryName}</option>
                                                                    </c:forEach>
                                                                </select>
                                                            </div>
                                                            <label class="layui-form-label">打</label>
                                                            <div class="layui-input-inline">
                                                                <input class="layui-input unit money2Check discountFormatter"
                                                                       name="promotionMoney2"
                                                                       lay-verify="required" placeholder="范围 0.1~9.9" type="text">
                                                                <span class="span">折</span>
                                                            </div>
                                                            <button type="button" class="layui-btn layui-btn-normal promotionRuleAddBtn">
                                                                <i class="layui-icon">&#xe654;</i>追加
                                                            </button>
                                                        </div>
                                                    </c:if>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-md2 right">
                                        <div class="layui-card" style="height: 100%;">
                                            <div class="layui-card-header" style="font-weight:900">操作</div>
                                            <div class="layui-card-body">
                                                <div class="layui-inline">
                                                    <button id="reset" type="reset" class="layui-btn layui-btn-normal">
                                                        <i class="layui-icon">&#xe669;</i>重置
                                                    </button>
                                                </div>
                                                <div class="layui-inline">
                                                    <%--                                 lay-submit=""--%>
                                                    <button id="submit" type="submit" lay-submit=""
                                                            class="layui-btn layui-btn-normal">
                                                        <i class="layui-icon">&#xe605;</i>提交
                                                    </button>
                                                </div>
                                                <br>
                                                <div class="layui-inline">
                                                    <button type="button" id="backToPromotionInfo" class="layui-btn layui-btn-normal">
                                                        <i class="layui-icon">&#xe65c;</i>返回
                                                    </button>
                                                </div>
                                                <div class="layui-inline">
                                                    <button type="button" id="addNewAgain" class="layui-btn layui-btn-disabled"
                                                            disabled="disabled">
                                                        <i class="layui-icon">&#xe654;</i>新建
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div id="promotionCreateTableDiv" style="padding:12px; background-color: #F2F2F2;display: none">
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-card">
                                    <div class="layui-card-header" style="font-weight:900">可参与商品</div>
                                    <div class="layui-card-body">
                                        <table class="layui-table" lay-value="${promotionType}" id="promotionCreateTable"
                                               lay-filter="promotionCreateTable"></table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>


</div>
</div>
<style>
    .layout {
        margin: 0 auto;
        height: auto;
        overflow: visible;
        position: relative;
    }

    .right {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
    }
</style>
<script src="../static/js/promotion.js"></script>
<script type="text/html" id="headerToolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm layui-btn-normal " value="add" lay-event="addPromotionWares">批量加入
        </button>
        <button class="layui-btn layui-btn-sm layui-btn-warm" value="del" lay-event="delPromotionWares">批量移出
        </button>
    </div>
</script>
<%@include file="extra/footer.jsp" %>
